package com.kotlin.myapplicationd;

import android.Manifest;
import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;


//import com.facebook.stetho.Stetho;

import com.tbruyelle.rxpermissions.RxPermissions;

import me.drakeet.library.CrashWoodpecker;

public class MApplication extends Application {

    private static Context instance;



    public static Context gainContext() {
        return instance;
    }

    public void onCreate() {
        super.onCreate();

        instance = this;
        if (BuildConfig.LOG_DEBUG) {
            CrashWoodpecker.init(this);//崩溃异常提示
            //Stetho.initializeWithDefaults(this);
        }





    }

    public static String getCurProcessName(Context context) {
        int pid = android.os.Process.myPid();
        ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningAppProcessInfo appProcess : activityManager.getRunningAppProcesses()) {
            if (appProcess.pid == pid) {
                return appProcess.processName;
            }
        }
        return null;
    }






}
